package com.zhuiyun.educations.api.record.controller;

import com.zhuiyun.educations.api.record.entity.Record;
import com.zhuiyun.educations.api.record.service.RecordService;
import com.zhuiyun.educations.common.response.CommonResult;
import com.zhuiyun.educations.util.pageUtil.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName RecordController
 * @Description TODO 开通会员管理
 * @Author ys
 * @Date 2023/6/20 14:25
 **/
@Slf4j
@RestController
@Api(tags = "开通会员管理")
@RequestMapping("/record")
public class RecordController {
    @Autowired
    RecordService recordService;
    /**
     * @Author ys
     * @Description TODO 分页查询
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/getRecord")
    @ApiOperation(value = "开通会员管理的分页查询方法")
    public CommonResult getRecord(PageRequest pageRequest) {
        return recordService.getRecord(pageRequest);
    }
    /**
     * @Author ys
     * @Description TODO 逻辑删除
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @DeleteMapping("/deleteRecordById")
    @ApiOperation(value = "开通会员管理的逻辑删除方法")
    public CommonResult deleteRecordById(int id){
        log.info("逻辑删除");
        return recordService.deleteRecordById(id);
    }
    /**
     * @Author ys
     * @Description TODO 新增
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @PostMapping("/addRecord")
    @ApiOperation(value = "开通会员管理的新增方法")
    public CommonResult addRecord(@RequestBody Record record){
        log.info("新增");
        return recordService.addRecord(record);
    }
    /**
     * @Author ys
     * @Description TODO 开通用户下拉
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/userSelect")
    @ApiOperation(value = "开通会员管理的开通用户动态下拉方法")
    public CommonResult userSelect(){
        log.info("开通用户动态下拉");
        return recordService.userSelect();
    }
    /**
     * @Author ys
     * @Description TODO 会员类型下拉
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/memberSelect")
    @ApiOperation(value = "开通会员管理的会员类型动态下拉方法")
    public CommonResult memberSelect(){
        log.info("会员类型动态下拉");
        return recordService.memberSelect();
    }
}
